<!--模板开始-->
<style type="text/css">
    
*
{
    padding: 0px;
    margin: 0px;
    -webkit-box-sizing: border-box;
}

body
{
    background-color: white;
}

#container
{
    width: 500px;
    height: 815px;
    position: absolute;
    overflow: hidden;
}
#container > div,#container > img
{
    position: absolute;
}
.meigui1
{
    top: 592px;
    left: 0px;
    width: 228px;
    height: 224px;
    -webkit-transform-origin: 20% 100%;
    -webkit-animation: meigui 2s ease-in-out infinite alternate;
}
.meigui2
{
    top: 454px;
    left: 0px;
    width: 206px;
    height: 361px;
    -webkit-transform-origin: 20% 100%;
    -webkit-animation: meigui 3s  ease-in-out infinite alternate;
}
@-webkit-keyframes meigui
{
    from  {-webkit-transform: rotate(0deg);}
    to    {-webkit-transform: rotate(3deg);}
}
.dian1
{
    left: 175px;
    top: 720px;
    opacity: 0;
    -webkit-animation: dian 4s 2s linear infinite;
}
.dian2
{
    left: 175px;
    top: 720px;
    -webkit-animation: dian 4s linear infinite;
}
@-webkit-keyframes dian
{
    0%   {-webkit-transform: translate(0px,0px);opacity: 0}
    50%  {-webkit-transform: translate(0px,-50px);opacity: 1}
    100% {-webkit-transform: translate(0px,-100px);opacity: 0}

}
.yezi1
{
    left: 22px;
    top: 267px;
    position: absolute;
}
.yezi2
{
    left: 5px;
    top: 129px;
    position: absolute;
}
#potdiv
{
    width: 500px;
    height: 150px;
    /*background-color: #fff;*/
}
@-webkit-keyframes pot
{
    0%    {opacity: 0}
    50%   {opacity: 0.6}
    100%  {opacity: 0} 
}
.xin1
{
    left: 58px;
    top: 83px;
    width: 30px;
    -webkit-transform: rotate(-40deg);
    -webkit-animation: xin1 2s linear infinite alternate;
}
.xin2
{
    left: 79px;
    top: 82px;
    width: 23px;
    -webkit-transform: rotate(-30deg);
    -webkit-animation: xin2 2s linear infinite alternate;
}
.xin3
{
    left: 226px;
    top: 116px;
    width: 24px;
    -webkit-transform: rotate(13deg);
    -webkit-animation: xin3 2s linear infinite alternate;
}
.xin4
{
    left: 435px;
    top: 110px;
    width: 33px;
    -webkit-transform: rotate(-13deg);
    -webkit-animation: fadeout 2s linear infinite alternate;
}
.xin9
{
    left: 431px;
    top: 106px;
    width: 40px;
    -webkit-transform: rotate(-13deg);
}
.xin5
{
    left: 236px;
    top: 757px;
    width: 30px;
    -webkit-transform: rotate(0deg);
    -webkit-animation: xin5 2s linear infinite alternate;
}
.xin6
{
    left: 255px;
    top: 767px;
    width: 23px;
    -webkit-transform: rotate(11deg);
    -webkit-animation: xin6 2s linear infinite alternate;
}
.xin7
{
    left: 332px;
    top: 772px;
    width: 22px;
    -webkit-transform: rotate(0deg);
    -webkit-animation: fade1 2s linear infinite alternate;
}
.xin8
{
    left: 452px;
    top: 740px;
    width: 35px;
    -webkit-transform: rotate(-18deg);
    -webkit-animation: fadeout 2s linear infinite alternate;
}
.xin10
{
    left: 447px;
    top: 734px;
    width: 47px;
    -webkit-transform: rotate(-18deg);
}

@-webkit-keyframes xin1
{
    from  {-webkit-transform: translate(0px,0px) rotate(-40deg);}
    to    {-webkit-transform: translate(-5px,-5px) rotate(-40deg);}
}
@-webkit-keyframes xin2
{
    from  {-webkit-transform: translate(0px,0px) rotate(-30deg);}
    to    {-webkit-transform: translate(-5px,-5px) rotate(-30deg);} 
}
@-webkit-keyframes xin3
{
    from  {-webkit-transform: translate(0px,0px) rotate(13deg);}
    to    {-webkit-transform: translate(3px,-4px) rotate(13deg);}
}
@-webkit-keyframes fadeout
{
    0%   {opacity: 1}
    50%  {opacity: 0}
    100% {opacity: 0}
}
@-webkit-keyframes fade1
{
    from  {opacity: 1}
    to    {opacity: 0.6}
}
@-webkit-keyframes xin5
{
    from  {-webkit-transform: translate(0px,0px) rotate(0deg)}
    to    {-webkit-transform: translate(0px,-5px) rotate(0deg)}
}
@-webkit-keyframes xin6
{
    from  {-webkit-transform: translate(0px,0px) rotate(11deg)}
    to    {-webkit-transform: translate(0px,-5px) rotate(11deg)}
}
.xin11
{
    left: 58px;
    top: 459px;
    width: 60px;
    opacity: 0;
    -webkit-animation: xin11 4s linear infinite;
}
@-webkit-keyframes xin11
{
    0%    {-webkit-transform: translate(0px,0px) rotate(0deg);opacity: 0}
    50%   {-webkit-transform: translate(0px,-60px) rotate(15deg);opacity: 1}
    100%  {-webkit-transform: translate(0px,-120px) rotate(30deg);opacity: 0}
}
.xin12
{
    left: 349px;
    top: 657px;
    -webkit-animation: xin12 4s linear infinite;
}
@-webkit-keyframes xin12
{
    0%    {-webkit-transform: translate(0px,0px) rotate(-10deg);opacity: 0}
    50%   {-webkit-transform: translate(0px,-50px) rotate(5deg);opacity: 1} 
    100%  {-webkit-transform: translate(0px,-100px) rotate(20deg);opacity: 0}
}
.xin13
{
    left: 369px;
    top: 407px;
    opacity: 0;
    -webkit-animation: xin13 3s linear infinite;
}
@-webkit-keyframes xin13
{
    0%    {-webkit-transform: translate(0px,0px) rotate(10deg);opacity: 0}
    50%   {-webkit-transform: translate(0px,-50px) rotate(-5deg);opacity: 1} 
    100%  {-webkit-transform: translate(0px,-100px) rotate(-20deg);opacity: 0}
}
.pot
{
    left: 239px;
    top: 563px;
    width: 30px;
    -webkit-animation: potting 2s linear infinite;
}
@-webkit-keyframes potting
{
    0%   {opacity: 0}
    40%  {opacity: 1}
    48%  {opacity: 0.5}
    56%  {opacity: 1}
    64%  {opacity: 0.5}
    72%  {opacity: 1}
    /*80%  {opacity: 1}*/
    100% {opacity: 0}
}
#xindiv
{
    width: 500px;
    height: 200px;
    top: 274px;
    left: -100px;
}
@-webkit-keyframes myfadein
{
    from  {opacity: 0}
    to    {opacity: 1}
}
@-webkit-keyframes titlein
{
    from  {-webkit-clip-path: polygon(0% 0%,0% 0%,0% 100%,0% 100%);}
    to    {-webkit-clip-path: polygon(0% 0%,100% 0%, 100% 100%, 0% 100%);}
}
@-webkit-keyframes xinmove
{
    0%   {-webkit-transform: translate(0px,0px);opacity: 0}
    10%  {-webkit-transform: translate(30px,0px);opacity: 1}
    90%  {-webkit-transform: translate(250px,0px);opacity: 1}
    100% {-webkit-transform: translate(280px,0px);opacity: 0}

}
@-webkit-keyframes titleout
{
    from  {-webkit-transform: translate(0px,0px) scale(1,1);opacity: 1}
    to    {-webkit-transform: translate(0px,100px) scale(1,0);opacity: 0}
}
.div
{
    border: 4px solid #fff;
    opacity: 0;
}
@-webkit-keyframes div_in
{
    0%   {-webkit-transform: translate(0px,-280px) rotate(-12deg);opacity: 0}
    40%  {-webkit-transform: translate(0px,-50px) rotate(-2deg);opacity: 1;}
    80%  {-webkit-transform: translate(0px,0px) rotate(2deg);opacity: 1;-webkit-animation-timing-function: ease-in;}
    100% {-webkit-transform: translate(0px,150px) rotate(8deg);opacity: 0}

}
.wordspan
{
    width: 50%;
    right: 3%;
    position: absolute;
    color: #fff;
    font-size: 25px;
    text-align: center;
    bottom: 7px;
    text-shadow: 1px 1px 2px #000;
    font-weight: bold;
}
.guang1
{
    position: absolute;
    left: 169px;
    top: 43px;
    width: 32px;
    -webkit-transform-origin: 50% 40%;
    /*-webkit-transform:rotate(90deg);*/
    -webkit-animation: guang1 2s linear infinite;
}
.guang2
{
    position: absolute;
    left: 188px;
    top: 51px;
    width: 30px;
    -webkit-transform-origin: 50% 40%;
    -webkit-animation: guang1 2s linear infinite;
}
@-webkit-keyframes guang1
{
    0%   {-webkit-transform:rotate(0deg);opacity: 0}
    20%  {-webkit-transform:rotate(0deg);opacity: 1}
    50%  {-webkit-transform:rotate(90deg);opacity: 0}
    100% {opacity: 0}
}
.guang3
{
    position: absolute;
    left: 80px;
    top: 10px;
    width: 30px;
    -webkit-transform-origin: 50% 40%;
    -webkit-animation: guang3 2s 1s linear infinite;
}
@-webkit-keyframes guang3
{
    0%   {-webkit-transform:rotate(0deg);opacity: 0}
    20%  {-webkit-transform:rotate(0deg);opacity: 1}
    35%  {-webkit-transform:rotate(45deg);opacity: 0.6}
    50%  {-webkit-transform:rotate(0deg);opacity: 0}
    100% {opacity: 0}
}
</style>

<div id='container'>
    <img src='{$skinurl}skin/rose/bg.jpg'>
    <img class='pot' src='{$skinurl}skin/rose/pot.png'>

    <div id='div1' class='div'>
        <div id='word1' class='wordspan'></div>
    </div>
    <div id='div2' class='div'>
        <div id='word2' class='wordspan'></div>
    </div>

    <img src='{$skinurl}skin/rose/up.png'>
    <img class='dian1' src='{$skinurl}skin/rose/dian.png'>
    <img class='dian2' src='{$skinurl}skin/rose/dian02.png'>




    <div id='potdiv'>

    </div>

    <img class='xin9' src='{$skinurl}skin/rose/xin02.png'>
    <img class='xin10' src='{$skinurl}skin/rose/xin02.png'>
    <img class='xin1' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin2' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin3' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin4' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin5' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin6' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin7' src='{$skinurl}skin/rose/xin01.png'>
    <img class='xin8' src='{$skinurl}skin/rose/xin01.png'>
    
    
    <img class='xin11' src='{$skinurl}skin/rose/xin03.png'>
    <img class='xin12' src='{$skinurl}skin/rose/xin03.png'>
    <img class='xin13' src='{$skinurl}skin/rose/xin03.png'>

    <div class='meigui2'>
        <img src='{$skinurl}skin/rose/meigui2.png'>
        <img class='yezi1' src='{$skinurl}skin/rose/yezi01.png'>
        <img class='yezi2' src='{$skinurl}skin/rose/yezi02.png'>
        <img class='guang2' src='{$skinurl}skin/rose/g.png'>
    </div>
    <div class='meigui1'>
        <img src='{$skinurl}skin/rose/meigui.png'>
        <img class='guang1' src='{$skinurl}skin/rose/g.png'>
        <img class='guang3' src='{$skinurl}skin/rose/g.png'>
    </div>

    

    <div id='xindiv'>
    </div>

    <div id='pagetitle' style='position:absolute;top:280px;left:89px;opacity:0;width:323px;height:200px'>
        <img style='position:absolute;left:15px;top:-45px' src='{$skinurl}skin/rose/wenzidi.png'>
        <img style='position:absolute;left:15px;top:153px;-webkit-transform: scale(1,-1)' src='{$skinurl}skin/rose/wenzidi.png'>
        <div id='titlediv' style='position:absolute;width:288px;height:150px;top:22px;left:17px;overflow:hidden;display:table;-webkit-clip-path: polygon(0% 0%,0% 0%,0% 100%,0% 100%);'>
            <div id='titlecontent' style='width:288px;height:150px;vertical-align:middle;display:table-cell;text-align:center;font-size:26px;line-height:34px;color:#fff;'></div>
        </div>
    </div>

    
    
</div>

<script>

function  id (name) 
{
    return document.getElementById(name);
}

function rand(min,max)
{
    return min+Math.floor(Math.random()*(max-min+1));
}

function showtitle()
{
    id('pagetitle').style.webkitAnimation = 'myfadein 0.5s linear both';
    id('titlecontent').innerHTML = e_title;
    id('titlediv').style.webkitAnimation = 'titlein 4s 0.1s linear both';
    id('xindiv').style.webkitAnimation = 'xinmove 4.2s linear both';

    // setTimeout(distitle,6000)
}

function kuxuan()
{
    id('pagetitle').style.webkitAnimation = 'titleout 1.5s linear both';

    timeout[3] = setTimeout(show1,1000)
}

function show1()
{
    setImage('1');
    id('div1').style.webkitAnimation = 'div_in 8s linear both';
    id('div2').style.webkitAnimation = '';

    timeout[1] = setTimeout(show2, 8000)
}

function show2()
{
    setImage('2');
    id('div2').style.webkitAnimation = 'div_in 8s linear both';
    id('div1').style.webkitAnimation = '';

    timeout[2] = setTimeout(show1, 8000)
}

function loading () 
{
    createpot();
    createxin();
    load_images();

}

function createxin()
{

    var xindiv = id('xindiv');
    var radius = 80;

    for(var i = 0 ; i< 20; i++)
    {
        var img = new Image();
        img.src='{$skinurl}skin/rose/xin.png';
        img.style.position = 'absolute';
        img.style.left = '200px';
        img.style.top = '100px';

        var angle = rand(0,360);
        var totop = Math.sin(angle*Math.PI/180) * radius;
        var toleft = Math.cos(angle*Math.PI/180) * radius;

        var csstext='@-webkit-keyframes heart'+i+' {from{-webkit-transform:translate(0px,0px);opacity:1;} to{-webkit-transform:translate('+toleft+'px,'+totop+'px);opacity:0;}}';
        var style=document.createElement('style');
        document.head.appendChild(style);
        var sheet=style.sheet;
        sheet.insertRule(csstext,0);

        img.style.webkitAnimation = 'heart' + i + ' 1.5s '+rand(0,30)/20+'s linear infinite';

        xindiv.appendChild(img);
    }




}

function createpot()
{
    var potdiv = id('potdiv');
    var potnum = 10;
    for(var i = 0 ;i < potnum ; i++)
    {
        var img = new Image();
        img.src='{$skinurl}skin/rose/pot.png';
        img.style.position = 'absolute';
        img.style.left = i * (500/potnum) + 'px';
        img.style.top = rand(0,100) + 'px';
        img.style.width = '30px';
        img.style.opacity = 0;
        img.style.webkitAnimation = 'pot 2s '+ rand(0,20)/20 +'s linear infinite';

        potdiv.appendChild(img);
    }
}

function setImage(idname)
{

    if(reshow == true)
        return;

    while(Onload_imgs_url[image_url_index] == 'not find' || Onload_imgs_url[image_url_index] == 'loading')
    {
        if(image_url_index % step_loadnum == 0)
        {
            step_load();
        }
        image_url_index++;
        if(image_url_index == Onload_imgs_url.length)
            image_url_index = 0;
    }

    if(image_url_index % step_loadnum == 0)
    {
        step_load();
    }
    var img_bili = image_size_width[image_url_index]/image_size_height[image_url_index];

    var div = id('div'+idname);

    div.style.backgroundImage = 'url('+Onload_imgs_url[image_url_index]+')';

    var word = id('word' + idname);
    var str = words[get_pid(Onload_imgs_url[image_url_index])];
    if(str != undefined)
    {
        word.innerHTML = str;
    }
    else
    {
        word.innerHTML = '';
    }
    //500 760
    if(img_bili < (380/600))
    {
        var height = 600;
        var width = 600 * img_bili;
        var top = 80;
        var left = (500-width)/2;
    }
    else if(img_bili <= 1)
    {
        var width = 420;
        var height = 420 / img_bili;
        var left = 40;
        var top = (740-height)/2
    }
    else if(img_bili > 1)
    {
        var width = 480;
        var height = 480/img_bili;
        var left = 10;
        var top = (760-height)/2;
    } 

    div.style.width = width + 'px';
    div.style.height = height + 'px';
    div.style.left = left + 'px';
    div.style.top = top + 'px';
    div.style.backgroundSize = (width-8) + 'px ' + (height-8) + 'px';


    image_url_index ++;
    if(image_url_index == Onload_imgs_url.length)
      image_url_index = 0;
}


//每次执行加载后5张图片
var bl_keepload = 'first';
var step_loadnum = 5;
function step_load()
{
    var load_num = 0
    //初步加载X张
    if(image_url_index  == 0 && bl_keepload == 'first')
    {
        console.log('loading continue');
        if(slider_images_url.length > step_loadnum)
        {
            load_num = step_loadnum;
            bl_keepload = 'next';
        }
        else
        {
            load_num = slider_images_url.length;
            bl_keepload = 'end';
        }
        for(var i = 0; i< load_num; i++)
        {
            var img=new Image();
            img.index=i;
            img.src=slider_images_url[i];
            img.onload=image_onload;
            img.onerror= image_onerror;
            Onload_imgs_url[i] = 'loading';
        }
    }
    else if(bl_keepload == 'end')
    {
        return;
    }
    else
    {
         console.log('loading continue');
        if(slider_images_url.length - image_url_index >step_loadnum*2)
        { 
            load_num = step_loadnum;
        }
        else
        {
            load_num = slider_images_url.length - image_url_index - step_loadnum;
            bl_keepload = 'end';
        }
        for(var i = image_url_index +step_loadnum; i< image_url_index + step_loadnum + load_num; i++)
        {
            var img=new Image();
            img.index=i;
            img.src=slider_images_url[i];
            img.onload=image_onload;
            img.onerror= image_onerror;
            Onload_imgs_url[i] = 'loading';
        }
    }

}
function load_images()
{
    reshow = false;
    image_size_width=[];
    image_size_height=[];
    Onload_imgs_url=[];
    image_url_index=0;
    have_num = 0;
    error_num = 0;
    begin_titletime = new Date();
    begin_titletime = begin_titletime.getTime();
    canshow = true;
    showtitle();
    bl_keepload = 'first';
    step_load();       
}

function image_onerror(event)
{
    var img = event.target;
    var index = img.index;
    if(index<step_loadnum)
        error_num ++;
    Onload_imgs_url[index] = 'not find';

    if((have_num+error_num >= step_loadnum || slider_images_url.length == (have_num+error_num)) && canshow == true)
    {   
        reshow = false;
        canshow =false;
        if(have_num == 0)
            return;
        var end_titletime = new Date();
        end_titletime = end_titletime.getTime();
        var dis_titletime = Math.abs(end_titletime-begin_titletime);
        if(dis_titletime>delaytime)
        {
            kuxuan();
        }
        else
        {
            dis_titletime = delaytime- dis_titletime;
            timeout[0] = setTimeout(function()
                {
                    kuxuan();
                },dis_titletime);
        }
    }
}

function image_onload(event)
{
    if(reshow == true)
        return;

    var img = event.target;
    var index = img.index;

    if(index<step_loadnum)
    {
        have_num++;
    }
    Onload_imgs_url[index] = img.src;
    image_size_height[index] = img.height;
    image_size_width[index] = img.width;

    console.log(Onload_imgs_url[index]);
    // console.log(have_num + '-' + error_num);

    if((have_num + error_num >= step_loadnum ||slider_images_url.length == (have_num+error_num)) && canshow == true)
    {   
        reshow = false;
        canshow =false;
        if(have_num == 0)
            return;
        var end_titletime = new Date();
        end_titletime = end_titletime.getTime();
        var dis_titletime = Math.abs(end_titletime-begin_titletime);
        if(dis_titletime>delaytime)
        {
            kuxuan();
        }
        else
        {
            dis_titletime = delaytime- dis_titletime;
            timeout[0] = setTimeout(function()
                {
                    kuxuan();
                },dis_titletime);
        }

    }
}
var image_size_width=[];
var image_size_height=[];
var image_url_index=0;
var have_num = 0;
var error_num = 0;
var canshow = true;
var reshow = false;
var delaytime=6000;
var timeout = [];

call_me(loading);


function reload_scene()
{
    clearnode();
    reshow = true;
    setTimeout(load_images,100);
}

function clearnode()
{

    for(var i = 0; i<timeout.length; i++)
    {
        clearTimeout(timeout[i]);
    }

    var itemlist = ['pagetitle','titlediv','xindiv','div1','div2'];

    for(var i =0; i<itemlist.length;i++)
    {
        id(itemlist[i]).style.webkitAnimation = '';
    }

}

</script>
<!-- 模板结束 -->